import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import( '../components/Login')
    },
    {
        path: '/regist',
        name: 'Regist',
        component: () => import( '../components/Regist')
    },
    {
        path: '/main',
        redirect:"/welcome",
        component: () => import( '../components/Main'),
        children:[
            {
            path: '/welcome',
            component: () => import( '../components/Webcome'),
            },
            {
                path: '/booktype',
                component: () => import( '../Books/BookType'),
            },
            {
                path: '/bookroom',
                component: () => import( '../Books/BookRoom'),
            },
            {
                path: '/books',
                component: () => import( '../Books/Books'),
            },
            {
                path: '/user',
                component: () => import( '../User/user'),
            },
            {
                path: '/change_pwd',
                component: () => import( '../User/change_pwd'),
            },

        ]
    },

]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
